// WIP
//#define __DEBUG__
// by Xeno
#define THIS_FILE "fn_geardialogselchanged.sqf"
#include "x_setup.sqf"

PARAMS_1(_val);

_index = _val select 1;
if (_index == -1) exitWith {};
_ctrl = _val select 0;

_primweap = primaryWeapon player;
_selweap = _ctrl lbdata _index;
if (_primweap == _selweap) exitWith {};

player removeWeapon (primaryWeapon player);
player addWeapon _selweap;